﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using HyEduOnline.Services;
using System.Web.Security;
using HyEduOnline.Models;
namespace HyEduOnline.Services
{
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
    public class UserAuthorizeCom : System.Web.Mvc.AuthorizeAttribute
    {
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            if (httpContext == null)
            {
                throw new ArgumentNullException("HttpContext");
            }
            if (FrontUserInfo.GetUserID() < 1 && frontCurrentTea.GetUserID() < 1 
            && frontCurrentStu.GetUserID() < 1)
            {
                //未认证

                HttpContext.Current.Response.Redirect("~/Login/CommonUser");
                HttpContext.Current.Response.End();

                return false;
            }
            return true;
        }
    }
}